<?php
namespace ShopApi\Controller;
use Zend\Mvc\Controller\AbstractRestfulController;
use Zend\View\Model\JsonModel;
class ShopReportsApiController extends AbstractRestfulController
{
    public function getList()
    {			
			
    }
    public function get($shop_id)
    {			
		header('Access-Control-Allow-Origin: *');	
		$orderDeliveryDetailsTable=$this->getServiceLocator()->get('Models\Model\OrderDeliveryDetailsFactory');
		$getShopReports = $orderDeliveryDetailsTable->getShopReports($shop_id)->toarray();
		if(count($getShopReports)!=0){
			return new JsonModel(array(
				'output' 	=> 'success',
				'data' 		=> json_encode($getShopReports),
			));
		}else{
			return new JsonModel(array(
				'output' => 'fail',
			));
		}	
    }
    public function create($data)
    {
		
    }
    public function update($order_delivery_details_id, $price)
    {
		header('Access-Control-Allow-Origin: *');
		$orderDeliveryDetailsTable=$this->getServiceLocator()->get('Models\Model\OrderDeliveryDetailsFactory');
		$updateOrderDetails = $orderDeliveryDetailsTable->updateOrderPrice($order_delivery_details_id,$price['price']);
		if($updateOrderDetails){
			return new JsonModel(array(
				'output' 	=> 'success',
			));
		}else{
			return new JsonModel(array(
				'output' => 'fail',
			));
		}	
    }
    public function delete($id)
    {
       
    }
}